<!-- index.html -->
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
</head>

<body style="font-size: 30px;" onload='bodyOnLoadLocalStorage()'>
  Hello world!
  <div id="result">xxx</div>
</body>
<script type="text/javascript">
  function bodyOnLoadLocalStorage() {
    console.log('zqf');
    if (typeof (Storage) !== 'undefined') {
      document.getElementById('result').innerHTML = localStorage.getItem('color');
    } else {
      document.getElementById('result').innerHTML = 'Your browser does not support localStorage.';
    }
  }
</script>

</html>